home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / experimental_shield.lua < prev    next >
Encoding:
Text File  |  2006-02-27  |  4.2 KB  |  149 lines

  1.  
  2. function effects_experimentalShield_onCreate()
  3.     local effect = uniGetExecutor()
  4.     consoleWrite("and now some magic...")
  5.     -- add position interpolator
  6.     local interpolator = createInterpolator()
  7.     interpolator:addKey(0.0,-15.0)
  8.     interpolator:addKey(1.4,15.0)
  9.     interpolator:addKey(2.8,-15.0)
  10.     interpolator:finalize(false)
  11.     -- add interpolator on localPosition Y
  12.     effect:addInterpolator(interpolator,getFieldOffset(EN_FIELD_LOCALPOSITION_Y))
  13. end
  14.  
  15. --
  16. -- particle system creation test
  17. --
  18. desc = getEffectDescriptionP(ENET_EFFECT_EXPERIMENTAL_SHIELD)
  19.  
  20. desc.onCreate = "effects_experimentalShield_onCreate"
  21. --desc.onCreateLuaFunctionName = "effects_experimentalShield_onCreate"
  22.  
  23. desc.ClassID = ENCLASS_SIMPLEPARTICLESYSTEM
  24. desc.EffectClassType = ENECT_PARTICLESYSTEM
  25.  
  26. desc.ScriptSet = ENSCRIPTSET_UNKNOWN
  27. desc.RelativePosition = ENLOCALPOS_NOTSPECIFIED
  28. local vzbzd1 = D3DXVECTOR3:new(0,0,0)
  29. desc.LocalPosition = vzbzd1
  30. vzbzd1:delete()
  31. desc.isAnimateTexture = false
  32. desc.RenderType = ENRENDERTYPE_GEOMETRY
  33.  
  34. Emitter = desc.PS.PSDescription
  35. Emitter.ParticleTypesNumber = 1
  36. local vzbzd2 = D3DXVECTOR3:new(0,0,0)
  37. Emitter.EmitterPosition = vzbzd2
  38. vzbzd2:delete()
  39. local vzbzd3 = D3DXVECTOR3:new(0,0,0)
  40. Emitter.EmitterDirection = vzbzd3
  41. vzbzd3:delete()
  42. Emitter.EmitterLifeTime = 10000
  43.  
  44. PT = Emitter.ParticleTypesParams[1]
  45. PT.IsEmitterLocked = false
  46. PT.DrawOrder = 1
  47. PT.Material = ENMAT_PARTICLE_LIGHT
  48.  
  49. PT.TextureName = "particle.dds";
  50.  
  51. PT.ParticlesPerSecond = 50.0;
  52. PT.InitialNumberOfParticles = 0.0;
  53. PT.BaseLifeTime = 1.7;
  54. PT.BaseLifeTimeVariance = 0.0;
  55. PT.BaseSpeed = 0.0;
  56. PT.BaseSpeedVariance = 0.0;
  57. PT.BaseAngle = 0.0;
  58. PT.BaseAngleVariance = 0.0;
  59. PT.BaseAngleSpeed = 0.0;
  60. PT.BaseAngleSpeedVariance = 0.0;
  61. PT.BaseAngleSpeedDirection = 0;
  62. local vzbzd4 = D3DXVECTOR3:new(0.0,0.0,0.0)
  63. PT.BaseDirection = vzbzd4
  64. vzbzd4:delete()
  65. local vzbzd5 = D3DXVECTOR3:new(0.0,0.0,0.0)
  66. PT.BaseDirectionVariance = vzbzd5
  67. vzbzd5:delete()
  68. local vzbzd6 = D3DXVECTOR3:new(0,0,0)
  69. PT.BasePosition = vzbzd6
  70. vzbzd6:delete()
  71. local vzbzd7 = D3DXVECTOR3:new(0,0,0)
  72. PT.BasePositionVariance = vzbzd7
  73. vzbzd7:delete()
  74. PT.BaseSize = 3.0;
  75. PT.BaseSizeVariance = 0.0;
  76.  
  77. -- color over time
  78. PT.ColorOverTimeR[1].TimePercent = 0.0
  79. PT.ColorOverTimeR[1].Value = 0.0
  80. PT.ColorOverTimeG[1].TimePercent = 0.0
  81. PT.ColorOverTimeG[1].Value = 1.0
  82. PT.ColorOverTimeB[1].TimePercent = 0.0
  83. PT.ColorOverTimeB[1].Value = 0.0
  84.  
  85. PT.ColorOverTimeR[2].TimePercent = 0.5
  86. PT.ColorOverTimeR[2].Value = 1.0
  87. PT.ColorOverTimeG[2].TimePercent = 0.5
  88. PT.ColorOverTimeG[2].Value = 0.0
  89. PT.ColorOverTimeB[2].TimePercent = 0.5
  90. PT.ColorOverTimeB[2].Value = 0.0
  91.  
  92. PT.ColorOverTimeR[3].TimePercent = 1.0
  93. PT.ColorOverTimeR[3].Value = 0.0
  94. PT.ColorOverTimeG[3].TimePercent = 1.0
  95. PT.ColorOverTimeG[3].Value = 0.0
  96. PT.ColorOverTimeB[3].TimePercent = 1.0
  97. PT.ColorOverTimeB[3].Value = 1.0
  98.  
  99. -- transparency over time
  100. PT.TransparencyOverTime[1].TimePercent = 0.0;
  101. PT.TransparencyOverTime[1].Value = 0.0;
  102.  
  103. PT.TransparencyOverTime[2].TimePercent = 0.3;
  104. PT.TransparencyOverTime[2].Value = 1.0;
  105.  
  106. PT.TransparencyOverTime[3].TimePercent = 0.7;
  107. PT.TransparencyOverTime[3].Value = 1.0;
  108.  
  109. PT.TransparencyOverTime[4].TimePercent = 1.0;
  110. PT.TransparencyOverTime[4].Value = 0.0;
  111.  
  112. -- size over time
  113. PT.SizeOverTime[1].TimePercent = 0.0;
  114. PT.SizeOverTime[1].Value = 1.0;
  115.  
  116. PT.SizeOverTime[2].TimePercent = 1.0;
  117. PT.SizeOverTime[2].Value = 1.0;
  118.  
  119. -- Speed over time
  120. PT.SpeedOverTime[1].TimePercent = 0.0;
  121. PT.SpeedOverTime[1].Value = 0.0;
  122.  
  123. PT.SpeedOverTime[2].TimePercent = 1.0;
  124. PT.SpeedOverTime[2].Value = 0.0;
  125.  
  126. -- Tangent Speed over time
  127. PT.TangentSpeedOverTime[1].TimePercent = 0.0;
  128. PT.TangentSpeedOverTime[1].Value = 0.0;
  129.  
  130. PT.TangentSpeedOverTime[2].TimePercent = 1.0;
  131. PT.TangentSpeedOverTime[2].Value = 0.0;
  132.  
  133. -- GravityAcceleration over time
  134. PT.GravityAccelerationOverTime[1].TimePercent = 0.0;
  135. PT.GravityAccelerationOverTime[1].Value = 0.0;
  136.  
  137. PT.GravityAccelerationOverTime[2].TimePercent = 1.0;
  138. PT.GravityAccelerationOverTime[2].Value = 100.0;
  139.  
  140. -- AngleSpeed over time
  141. PT.AngleSpeedOverTime[1].TimePercent = 0.0;
  142. PT.AngleSpeedOverTime[1].Value = 0.0;
  143.  
  144. PT.AngleSpeedOverTime[2].TimePercent = 1.0;
  145. PT.AngleSpeedOverTime[2].Value = 0.0;
  146. --
  147. -- end particle system description
  148. --
  149.